import request from '@/utils/request';
import config from "@/config";

// 接口地址
const url = {
    TaskContentGetDetail: `${config.domain}/bus/task-content/getDetail`,
    AnswersContentGetDetail: `${config.domain}/bus/task-commit-record/getDetail`,
    AnswersContentAdd: `${config.domain}/bus/task-commit-record/addCommitRecord`,
    AnswersContentUpdate: `${config.domain}/bus/task-commit-record/updateCommitRecord`,
    TaskCommitGetDetail: `${config.domain}/bus/task-commit-record/getDetail`
};


// 获取详情，包括题目列表
export async function getQuestions(id) {
    return request(url.TaskContentGetDetail + `/${id}`);
}

// 根据id获取回答内容
export async function getAnswers(id) {
    return request(url.AnswersContentGetDetail + `/${id}`);
}

// 添加回答
export async function addAnswersContent(params) {
    return request(url.AnswersContentAdd, {
        method: "POST",
        body: params
    });
}

// 编辑回答
export async function updateAnswersContent(params) {
    return request(url.AnswersContentUpdate, {
        method: "POST",
        body: params
    });
}

// 获取提交详情和题目
export async function getCommitDetails(id){
    return request(url.TaskCommitGetDetail + `/${id}`);
}
